//
//  XILayer.h
//  XI Engine
//
//  Created by Balazs Faludi on 21.06.09.
//  Copyright 2009 Balazs Faludi. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "XIEngine.h"

#if TARGET_OS_IPHONE
#import "chipmunk.h"
#endif

@class XIObject;
//@class XIScene;

@interface XILayer : NSObject
{
	XIScene *scene;
	
	BOOL ignoresPause;
	
	NSArray *objects;
	NSTimeInterval timeAccumulator;
	
	BOOL physicsEnabled;
#if TARGET_OS_IPHONE
	cpSpace *space;
#endif
	
	
}

- (id)initFromDictionary:(NSDictionary *)dict;
- (id)initWithXilName:(NSString *)xilName bundle:(NSBundle *)xilBundle;
- (void)loadFromDictionary:(NSDictionary *)dict;
- (NSMutableDictionary *)saveStateToDictionary;
- (NSMutableDictionary *)saveToDictionary;

#if TARGET_OS_IPHONE
- (void)setupChipmunk; // Bootstraps chipmunk
- (void)enablePhysics; // Enables physics simulation for the scene.
- (void)disablePhysics;
#endif

#if TARGET_OS_IPHONE
- (void)update;
#endif
- (void)draw;

- (void)removeObject:(XIObject *)object;
- (void)insertObject:(XIObject *)object atIndex:(int)index;
- (void)addObject:(XIObject *)object;
- (NSArray *)objectsAtPoint:(CGPoint)point;

@property (nonatomic, retain) XIScene *scene;
@property (nonatomic) BOOL ignoresPause;
@property (nonatomic, retain) NSArray *objects;
@property (nonatomic) BOOL physicsEnabled;
#if TARGET_OS_IPHONE
@property (nonatomic) cpSpace *space;
#endif

@end
